package springcloud.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.buba.springcloud.pojo.ChinaData;
import com.buba.springcloud.pojo.CityData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import springcloud.mapper.ChinaDataMapper;
import springcloud.mapper.CityDataMapper;
import springcloud.service.IChinaDataService;
import springcloud.service.ICityDataService;

import java.util.ArrayList;


@Slf4j
@Service
public class CityDataServiceImpl extends ServiceImpl<CityDataMapper, CityData> implements ICityDataService {

    @Autowired
    CityDataMapper cityDataMapper;

    @Override
    public ArrayList<CityData> getCityData() {

        QueryWrapper<CityData> lqw = new QueryWrapper<CityData>();
        lqw.orderByDesc("local_confirm_add").last("limit 5");

        ArrayList<CityData> result = (ArrayList)cityDataMapper.selectList(lqw);
        return result;

    }
}
